<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%--<%@ include file="../../include/header.jsp" %>--%>
<link rel="stylesheet" type="text/css" href="../../resources/js/plugins/layui/css/layui.css"/>
<style>
    .tip {
        font-size: 14px;
        color: #CC3E00;
        padding: 10px;
        letter-spacing: 1px;
        line-height: 30px;
    }
    .layui-btn + .layui-btn{
        margin-left: 0px;
    }
</style>
<div class="right pagecont">
    <%--<div class="ptitle">
        <div class="title">我的应聘</div>
        <div class="position">你现在的位置：<a href="http://www.cqmetro.cn">首页</a> > <a href="${path}/">人才招聘</a> > 我的应聘</div>
        <div class="clear"></div>
    </div>--%>

    <div class="pcont" style="border-left:none;border-right:none;border-bottom:none;">
        <div id="Content" style="width:98%; height:auto; margin:0 auto;">

            <div class="pagecont" style="width:100%; padding-left:0;padding-bottom:20px;">
                <div class="layui-row">
                    <div class="layui-col-sm10" style="padding: 10px 0px;">
                        <fieldset class="layui-elem-field " style="padding-top: 10px;">
                            <legend>${proname}---${jname}</legend>

                            <div class="layui-field-box">
                                <ul class="layui-timeline">
                                    ${result}
                                </ul>
                            </div>

                        </fieldset>
                    </div>
                    <div class="layui-col-sm1" style="margin-top: 30px;margin-left: 30px;">
                        ${buttons}
                        <%--<button  class="layui-btn layui-btn-danger layui-btn-sm" id="btn_giveup">放弃本次招聘</button>
                        <button class="layui-btn layui-btn-danger layui-btn-sm" id="btn_printJobApply" style="margin-top: 10px;">打印职位申请表</button>
                        <button class="layui-btn layui-btn-normal layui-btn-sm" id="btn_showhistory" style="margin-top: 10px;">应聘历史</button>--%>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="../../resources/js/jquery-1.9.1.min.js" type="text/javascript" ></script>
<script src="../../resources/js/plugins/layui/layui.all.js"  type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $('.btn button').click(function () {
            $(this).parent().prev().toggleClass('active').parent().next().slideToggle(300);
            $(this).toggleClass('hide').toggleClass('show');
        });

        /*$("#valiCodeimg").click(function () {
            $(this).attr('src', '${path}/resources/captcha.jpeg?time=' + (new Date()).getTime());
        });*/
    });

    function refushCode(c) {
        $(c).attr('src', '${path}/resources/captcha.jpeg?time=' + (new Date()).getTime());
    }
    function Print(url) {
        window.open(url);
    }
    $(function () {
        var giveupform;
        $('#btn_giveup').click(function () {
            //$('#btn_giveup').attr('disabled','disabled');
            layer.open({
                type: 1
                ,title: '请输入验证!' //不显示标题栏
                ,closeBtn: false
                ,area: '300px;'
                ,zIndex:-1000
                ,shade: 0.8
                ,id: 'LAY_giveup' //设定一个id，防止重复弹出
                ,btn: ['确认放弃', '取消']
                ,btnAlign: 'c'
                ,moveType: 1 //拖拽模式，0或者1
                ,content: '<form id="ugiveupValid" method="post" action="${path}/Myhr/GiveUpSZ"><input type="hidden" name="id" value="${userid}" /><input type="hidden" name="pid" value="${proid}" /><input type="hidden" name="state" value="before" /><table class="treeTable inputform"><tbody><tr><td width="70">验 证 码：</td><td width="110" style="border-right:none;"><input type="text" class="valiCode" name="vcode" datatype="*" nullmsg="验证码不能为空！" /></td><td width="100"><img  style="width:100px;height:30px;" src="${path}/resources/captcha.jpeg" title="点击刷新" onClick="refushCode(this)"  /></td></tr></tbody></table></form>'
                ,success:function (layero,index) {
                    giveupform= $("#ugiveupValid").Validform({
                        ajaxPost: true,
                        callback: function (data) {
                            if (data.state) {
                                $.Hidemsg();
                                if (data.Message == "-1") {
                                    $.Showmsg('系统错误！');
                                }
                                else if (data.Message == "0.0") {
                                    layer.confirm('本轮招聘中，您本次放弃该岗位后只有一次重新选择岗位的机会。是否确认放弃该岗位？', {
                                        btn: ['决定放弃', '不放弃']
                                    }, function () {
                                        $('input[name=state]').val('ok');
                                        layer.closeAll();
                                        //$('#giveupValid').submit();
                                        giveupform.ajaxPost(false,true,'/Myhr/GiveUpSZ');
                                    }, function () {
                                        //不放弃
                                    });
                                } else if (data.Message == "1.0") {
                                    layer.confirm('本轮招聘中，您之前已经重新选择岗位，如再次放弃该岗位，则表示自愿放弃本次应聘！是否确认放弃该岗位？', {
                                        btn: ['决定放弃', '不放弃']
                                    }, function () {
                                        $('input[name=state]').val('ok');
                                        layer.closeAll();
                                        //$('#giveupValid').submit();
                                        giveupform.ajaxPost(false,true,'/Myhr/GiveUpSZ');
                                    }, function () {
                                        //不放弃
                                    });
                                } else {
                                    $.Showmsg(data.Message);
                                    setTimeout(function () {
                                        $.Hidemsg();
                                        if (data.state) {
                                            location.reload();
                                        }
                                    }, 2000);
                                    layer.close(index);
                                }
                            } else {
                                $.Showmsg(data.Message);
                                /*setTimeout(function () {
                                    $.Hidemsg();
                                    if (data.state) {
                                        location.reload();
                                    }
                                }, 2000);*/
                            }
                        }
                    });
                }
                ,yes: function(index, layero){
                    giveupform.ajaxPost(false,true,'/Myhr/GiveUpSZ');
                    //form.forms[0].ajaxPost();
                    return false;

                }

            });
            return false;
        });

        $('#btn_printJobApply').on('click',function () {
            window.open("/Myhr/Application?id=${userid}");
        });
        var msComfrimForm;
        $('#btn_MSConfirm').click(function () {
            //$('#btn_giveup').attr('disabled','disabled');
            layer.open({
                type: 1
                ,title: '请输入验证!' //不显示标题栏
                ,closeBtn: false
                ,area: '300px;'
                ,zIndex:-1000
                ,shade: 0.8
                ,id: 'LAY_MSCONFRIMFORM' //设定一个id，防止重复弹出
                ,btn: ['确认参加', '取消']
                ,btnAlign: 'c'
                ,moveType: 1 //拖拽模式，0或者1
                ,content: '<form id="msconfirmValid" method="post" action="${path}/Myhr/confirmMsGX"><input type="hidden" name="id" value="${userid}" /><input type="hidden" name="msconfrimid" value="${msconfrimid}" /><input type="hidden" name="state" value="before" /><table class="treeTable inputform"><tbody><tr><td width="70">验 证 码：</td><td width="110" style="border-right:none;"><input type="text" class="valiCode" name="vcode" datatype="*" nullmsg="验证码不能为空！" /></td><td width="100"><img  style="width:100px;height:30px;" src="${path}/resources/captcha.jpeg" title="点击刷新" onClick="refushCode(this)"  /></td></tr></tbody></table></form>'
                ,success:function (layero,index) {
                    msComfrimForm= $("#msconfirmValid").Validform({
                        ajaxPost: true,
                        callback: function (data) {
                            if (data.state) {
                                $.Hidemsg();
                                    $.Showmsg(data.Message);
                                    setTimeout(function () {
                                        $.Hidemsg();
                                        if (data.state) {
                                            location.reload();
                                        }
                                    }, 2000);
                                    layer.close(index);
                            } else {
                                $.Showmsg(data.Message);
                            }
                        }
                    });
                }
                ,yes: function(index, layero){
                    msComfrimForm.ajaxPost(false,true,'/Myhr/confirmMsGX');
                    //form.forms[0].ajaxPost();
                    return false;
                }
            });
            return false;
        });
    });
</script>
<%--
<%@ include file="../../include/footer.jsp" %>--%>
